{% load humanize %}
{% load widget_tweaks %}
{% load firecares_tags %}

<!DOCTYPE html>
<!--[if IE 8 ]>
<html class="no-js ie8" lang="en"> <![endif]-->
<!--[if IE 9 ]>
<html class="no-js ie9" lang="en"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<html class="no-js" lang="en"> <!--<![endif]-->
<head lang="en">
    <meta charset="UTF-8">
    <meta name="description" content="{% block meta_description %}Welcome to FireCARES, created by the Fire Fighter Safety and Deployment Study.  Login to learn how fire department resources are deployed to match your community risks."{% endblock %}>
    <meta name="author" content="Prominent Edge LLC">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <title>{% block meta_title %}Choose your department · FireCARES{% endblock %}</title>
    {% include 'firestation/_favicon.html' %}

    {% include "firestation/_firecares_style.html" %}

    {% include 'google_analytics.html' %}
    <script type="text/javascript">
    var states = {{ states|jsonify }};
    </script>
</head>

<body class="ct-headroom--fixedTopBar cssAnimate" ng-controller="departmentSelectionController" ng-app="fireStation">

{% include 'firestation/_mobile_navbar.html' %}
{% include 'firestation/_mobile_search.html' %}

<div id="ct-js-wrapper" class="ct-pageWrapper">

<div class="ct-navbarMobile">
    <button type="button" class="navbar-toggle">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
    </button>
    <a class="navbar-brand logo" href="{% url 'firestation_home' %}"><h1>FireCARES</h1></a>
    <button type="button" class="searchForm-toggle">
        <span class="sr-only">Toggle navigation</span>
        <span><i class="fa fa-search"></i></span>
    </button>
</div>

{% include 'firestation/_navbar.html' %}

<div class="ct-site--map">
    <div class="container">
        {% block breadcrumbs %}
            <a href="{% url 'firestation_home' %}">Home</a>
            <a href="{% url 'registration_register' %}">Register</a>
        {% endblock %}
    </div>
</div>
<header class="ct-mediaSection" data-stellar-background-ratio="0.3" data-type="parallax" data-bg-image="{{STATIC_URL}}images/firefighter-header.jpg" data-bg-image-mobile="assets/images/content/registration-parallax.jpg">
    <div class="ct-mediaSection-inner">
        <div class="container">
            <div class="col-md-12">
                {% block content %}
                <div class="row">
                    <div class="col-md-12 col-lg-12">
                        <ul>
                            {% for message in messages %}
                            <div class="alert {% if message.level == DEFAULT_MESSAGE_LEVELS.SUCCESS %}alert-success{% else %}alert-danger{% endif %}" role="alert">
                                <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                {{ message }}
                            </div>
                            {% endfor %}
                        </ul>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="ct-headerText--normal">
                        <h2 class="text-uppercase ct-fw-600 ct-u-marginBottom20">
                            <span class="ct-u-text--motive">FireCARES</span> registration
                        </h2>
                        You're almost there!  Simply select your fire department to finish your registration.  After an administrator verifies
                        your information, you'll be granted administrative access to this department.
                    </div>
                </div>
                <div class="col-md-6">
                    <form role="form" class="ct-formRegister pull-right-md" method="post" action="">
                        {% csrf_token %}
                        {% block form %}
                        <div class="ct-form--label--type3">
                            <div class="ct-u-displayTableVertical">
                                <div class="ct-u-displayTableCell">
                                    <div class="ct-input-group-btn">
                                        <button class="btn btn-primary">
                                            <i class="fa fa-user"></i>
                                        </button>
                                    </div>
                                </div>
                                <div class="ct-u-displayTableCell text-center">
                                    <span class="text-uppercase">CHOOSE YOUR DEPARTMENT</span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            {% with WIDGET_ERROR_CLASS='form-error' %}
                            <div class="ct-form--item ct-u-marginBottom20 form-group">
                                <label>State</label>
                                <select class="form-control input-lg no-dirty" id="id_state" name="state" ng-model="input.state" ng-options="option for option in department_states track by option"></select>
                                {{ form.state.errors }}
                            </div>
                            <div class="ct-form--item ct-u-marginBottom20 form-group ng-cloak has-feedback"
                                ng-if="loading || departments.length > 0">
                                <label>Department</label>
                                <span ng-if="loading" class="ng-cloak glyphicon glyphicon-refresh glyphicon-spin form-control-feedback" aria-hidden="true" style='color: white; right: auto;font-size: 150%;'></span>
                                <select class="form-control input-lg no-dirty" id="id_department" name="department" ng-model="input.department" ng-options="option.name for option in departments track by option.id"></select>
                                {{ form.department.errors }}
                            </div>
                            {{ form.non_field_errors }}
                            {% endwith %}

                            <div class="ct-form--item">
                                <button type="submit" ng-disabled="!input.state || !input.department" class="btn btn-warning center-block">Select</button>
                            </div>
                        </div>
                        {% endblock %}
                    </form>
                </div>
                {% endblock %}
            </div>
        </div>
    </div>
</header>

{% include 'firestation/_partners.html' %}
{% include 'firestation/_footer.html' %}

</div>

{% include "firestation/_firecares_scripts.html" %}

</body>
</html>
